package com.xxdemo.site.validation;

import org.apache.commons.lang3.StringUtils;

public class Hostname {

    private final String value;

    private Hostname(String value) {
        this.value = value;
    }

    public static Hostname fromStr(String hostnameStr) {
        hostnameStr = StringUtils.defaultString(hostnameStr, "");
        String trimmed = hostnameStr.trim().toLowerCase();
        return new Hostname(trimmed);
    }

    public String getValue() {
        return value;
    }
}
